package com.javawork.igossip;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DBHelper extends SQLiteOpenHelper {

	private static final String DATABASE_NAME = "data.db";
	private static final int DATABASE_VERSION = 1;

	public DBHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL("CREATE TABLE IF NOT EXISTS user"
				+ "(username NVARCHAR, password VARCHAR, gender INTEGER, userid INTEGER, description TEXT, photo VARCHAR, tags TEXT)");
		db.execSQL("CREATE TABLE IF NOT EXISTS gossip"
				+ "(id INTEGER, content TEXT, picture TEXT, replycount INTEGER, target NVARCHAR, source NVARCHAR, time TEXT)");
		db.execSQL("CREATE TABLE IF NOT EXISTS message"
				+ "(id INTEGER, content TEXT, target NVARCHAR, source NVARCHAR, time TEXT)");
		db.execSQL("CREATE TABLE IF NOT EXISTS contact"
				+ "(username NVARCHAR, gender INTEGER, userid INTEGER, description TEXT, photo VARCHAR, tags TEXT)");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// db.execSQL("ALTER TABLE person ADD COLUMN other STRING");
	}
}
